﻿using System;
using System.ComponentModel;
using System.Web.UI.WebControls.WebParts;

/// <summary>
/// This class file contains overridden properties to be used in web parts that allow localization of
/// web part properties
/// </summary>

namespace DeGiglio.biz.Twitter.Classes
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public sealed class CategoryLocalizedAttribute : CategoryAttribute
    {
        public CategoryLocalizedAttribute(string keyName) : base(keyName) { }

        protected override string GetLocalizedString(string value)
        {
            return Common.GetResourceValue(value, Common.LocaleID);
        }
    }

    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public sealed class DescriptionLocalizedAttribute : WebDescriptionAttribute
    {
        public DescriptionLocalizedAttribute(string keyName) : base(keyName) { }

        public override string Description
        {
            get { return Common.GetResourceValue(base.Description, Common.LocaleID); }
        }
    }

    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public sealed class WebDisplayNameLocalizedAttribute : WebDisplayNameAttribute
    {
        public WebDisplayNameLocalizedAttribute(string keyName) : base(keyName) { }

        public override string DisplayName
        {
            get { return Common.GetResourceValue(base.DisplayName, Common.LocaleID); }
        }
    }
}
